import React from 'react'
import { BrowserRouter, useRoutes } from 'react-router-dom'
const Home = React.lazy(() => import('../views/home'))
const List = React.lazy(() => import('../views/list'))
const MainLayout = React.lazy(() => import('../views/mainLayout'))

const routes = [{
	path: '/',
	element: <MainLayout></MainLayout>,
	children: [{
		path: '/',
		element: <Home></Home>
	},{
		path: '/list',
		element: <List></List>
	}]
}]

const Index: React.FC = () => {
	const RouterView = () => useRoutes(routes)
	return (
		<BrowserRouter>
			<React.Suspense>
				<RouterView></RouterView>
			</React.Suspense>
		</BrowserRouter>
	)
}

export default Index